﻿<TestCase testName="Test_13_DBQueryReturnXml">
	<TestSetup></TestSetup>
	<TestExecution>
		
		<!--The below test step selects a row from the Orders table of the NorthWind database. The OrderId and ShipCity is loaded into 
				context variables with the value of the ship city being asserted to match 'Portland' -->
		<TestStep assemblyPath="" typeName="Microsoft.Services.BizTalkApplicationFramework.BizUnit.DBQueryReturnXmlStep">
				<DelayBeforeCheck>2</DelayBeforeCheck>
				<ConnectionString>Persist Security Info=true;Integrated Security=SSPI;database=AdventureWorks;server=(local);Connect Timeout=30</ConnectionString>
				<RootElement>OrdersRootElement</RootElement>
				<AllowEmpty>false</AllowEmpty>
				<SQLQuery>
					<RawSQLQuery>select Top 1 * from Person.Contact where FirstName = '{0}' for xml auto</RawSQLQuery>
					<SQLQueryParams>
						<SQLQueryParam>Kevin</SQLQueryParam>
					</SQLQueryParams>
				</SQLQuery>
				
				<!-- Load the  order Id and shipCity into context variables-->
			 	<ContextLoaderStep assemblyPath="" typeName="Microsoft.Services.BizTalkApplicationFramework.BizUnit.XmlContextLoader">
					<XPath contextKey="LastName">//Person.Contact/attribute::LastName</XPath>
					<XPath contextKey="Phone">//Person.Contact/attribute::Phone</XPath>
				</ContextLoaderStep>	
				
				<!--Perform basic validation to demonstrate validation functionality-->
			<ValidationStep assemblyPath="" typeName="Microsoft.Services.BizTalkApplicationFramework.BizUnit.ContextValidationStep">
				<Context keyName="LastName">Browne</Context>
				<Context keyName="Phone">496-555-0150</Context> 
			</ValidationStep> 
		</TestStep>			
		
		<!--The below test step makes use of the OrderId context variable that was created in the previous test step and uses it 
			to load Order Details -->
		
<!--	<TestStep assemblyPath="" typeName="Microsoft.Services.BizTalkApplicationFramework.BizUnit.DBQueryReturnXmlStep">
				<DelayBeforeCheck>2</DelayBeforeCheck>
				<ConnectionString>Persist Security Info=true;Integrated Security=SSPI;database=Northwind;server=(local);Connect Timeout=30</ConnectionString>
				<RootElement>OrderDetailsRootElement</RootElement>
				<AllowEmpty>false</AllowEmpty>
				<SQLQuery>
					<RawSQLQuery>select * from [Order Details] where OrderID={0} for xml auto </RawSQLQuery>
					<SQLQueryParams>
						<SQLQueryParam takeFromCtx="OrderId"></SQLQueryParam>
					</SQLQueryParams>
				</SQLQuery>
		</TestStep>	
-->		
		
		<!-- The below test step has the AllowEmpty element set to true. Thus when no Xml is returned, there is no error that will be raised. If AllowEmpty
				is set to false, the test step will fail as no Xml is returned. i.e. -->
<!--
		<TestStep assemblyPath="" typeName="Microsoft.Services.BizTalkApplicationFramework.BizUnit.DBQueryReturnXmlStep">
				<DelayBeforeCheck>2</DelayBeforeCheck>
				<ConnectionString>Persist Security Info=true;Integrated Security=SSPI;database=Northwind;server=(local);Connect Timeout=30</ConnectionString>
				<RootElement>OrdersRootElement</RootElement>
				<AllowEmpty>true</AllowEmpty>
				<SQLQuery>
					<RawSQLQuery>select Top 1 * from Orders where ShipCity='{0}' for xml auto </RawSQLQuery>
					<SQLQueryParams>
						<SQLQueryParam>Unknown City</SQLQueryParam>
					</SQLQueryParams>
				</SQLQuery>
		</TestStep>	
-->		
	</TestExecution>
  
	<!-- Test cleanup: test cases should always leave the system in the state they found it -->
	<TestCleanup>
    
  </TestCleanup>
</TestCase>
